home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Neon.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-02-07  |  2.5 KB  |  107 lines

  1. /* 
  2. ** $VER: Neon 3.0, IE Arexx script
  3. ** Image Engineer Macro script
  4. ** Copyright (C) 1997 Simon Edwards
  5. **
  6. ** Creates neon light lines out of image's color edges.
  7. **
  8. ** Ok, this should be the *definitive* last word in Neon scripts,
  9. ** combining best out of my algorithm and Patrik Nydensten's neon
  10. ** script.
  11. */
  12.  
  13. Options results
  14. Signal on error         /* Setup a place for errors to go */
  15.  
  16. if arg()==0 then exit
  17.  
  18. 'FORM "Neon" "Ok|Cancel"',
  19. ' INTEGER,"Size:",1,12,3,SLIDER',
  20. ' CHECKBOX,"Highlight Original",0',
  21. ' CYCLE,"Method:","Classic Neon|Thick Neon",0',
  22. ' INTEGER,"Sharp (Classic only)",1,12,1,SLIDER'
  23. parse var result ok thick highlight method sharp
  24.  
  25. thick=thick*2-1
  26. sharp=sharp*2-1
  27.  
  28. if ok=0 then exit
  29.  
  30. source=arg(1)
  31.  
  32. if method=0 then edgeimage=PatriksNeon()
  33. else edgeimage=SimonsNeon()
  34.  
  35. if highlight=1 then do
  36.     'MARK' arg(1) 'PRIMARY'
  37.     'MARK' edgeimage 'SECONDARY'
  38.     'COMPOSITE 0 0 ADD'
  39.     'CLOSE' edgeimage
  40. end
  41.  
  42. exit
  43.  
  44. PatriksNeon:
  45.     PROCEDURE EXPOSE source thick sharp
  46.     'CONVOLVE' source '"IE:Convolves/ColourLine_Thin"'
  47.     LineImage = Result
  48.  
  49.     if Thick ~= 1 then do
  50.       'MAXIMUM' LineImage Thick Thick
  51.       MaxThickImage = Result
  52.       'LOWPASS' MaxThickImage trunc((2+Thick)/2) trunc((2+Thick)/2)
  53.       ThickImage = Result
  54.       'CLOSE' MaxThickImage
  55.     end
  56.     else ThickImage = LineImage
  57.  
  58.     'MAXIMUM' LineImage Sharp Sharp
  59.     SharpImage = Result
  60.  
  61.     if Thick ~= 1 then 'CLOSE' LineImage
  62.  
  63.     'MARK' ThickImage 'PRIMARY'
  64.     'MARK' SharpImage 'SECONDARY'
  65.     'COMPOSITE' 0 0 'ADD'
  66.     edgeimage = Result
  67.     'CLOSE' ThickImage
  68.     'CLOSE' SharpImage
  69.     return edgeimage
  70.  
  71.  
  72. SimonsNeon:
  73.     PROCEDURE EXPOSE source thick
  74.     'MAXIMUM' source thick thick
  75.     maximage=Result
  76.  
  77.     'MINIMUM' source thick thick
  78.     minimage=Result
  79.  
  80.     'MARK' maximage 'PRIMARY'
  81.     'MARK' minimage 'SECONDARY'
  82.     'COMPOSITE 0 0 DIFFERENCE'
  83.     edgeimage=Result
  84.     'CLOSE' maximage
  85.     'CLOSE' minimage
  86.  
  87.     return edgeimage
  88.  
  89.  
  90. /*******************************************************************/
  91. /* This is where control goes when an error code is returned by IE */
  92. /* It puts up a message saying what happened and on which line     */
  93. /*******************************************************************/
  94. error:
  95. if RC=5 then do         /* Did the user just cancel us? */
  96.     IE_TO_FRONT
  97.     LAST_ERROR
  98.     'REQUEST "'||RESULT||'"'
  99.     exit
  100. end
  101. else do
  102.     IE_TO_FRONT
  103.     LAST_ERROR
  104.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  105.     exit
  106. end
  107.